//
//  BaseModel.h
//  s.
//
//  Created by fanshijian on 2022/8/24.
//  Copyright © 2022 J. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "UHomeLayout.h"

NS_ASSUME_NONNULL_BEGIN

@class SpaceModel;
@interface BaseModel : NSObject <CHGCollectionViewCellModelProtocol, CHGTableViewCellModelProtocol>

@property (strong, nonatomic) UHomeLayout *layout;

/// 重用标识符
@property (readonly, nonatomic) NSString *idf;
/// 针对同一个cell不同的idf
@property (readonly, nonatomic, nullable) NSString *idfContent;
/// 外面设置idf
@property (copy, nonatomic) NSString *(^idfBlock)(void);

/// 点击事件
@property (strong, nonatomic, nullable) NSDictionary *action;

/// 额外扩展字段
@property (strong, nonatomic, nullable) id jy_extra;
/// 属性值有更改
@property (assign, nonatomic) BOOL modified;
///  是否支持编辑
@property (assign, nonatomic) BOOL canEdit;
@property (assign, nonatomic) UITableViewCellEditingStyle editStyle;
@property (strong, nonatomic) NSArray<UITableViewRowAction*> *editAction;
@property (copy, nonatomic) void (^editActionBlock)(UITableViewRowAction *action, NSIndexPath *indexPath);

- (void)prepareLayoutDefault;
- (void)prepareLayout:(CGSize)size;
+ (instancetype)modelWithSize:(CGSize)size idf:(NSString *)idf;

SpaceModel *space_s(CGFloat w, CGFloat h);
SpaceModel *space_ff(CGFloat h);
SpaceModel *space_f5(CGFloat h);
SpaceModel *space_s_ff(CGFloat w, CGFloat h);
SpaceModel *space_s_f5(CGFloat w, CGFloat h);
SpaceModel *space_sc(CGSize size, NSString * __nullable color);

SpaceModel *t_space_hc(CGFloat h, NSString * __nullable color);

@end

NS_ASSUME_NONNULL_END
